package com.acme;

import com.acme.collections.IntHashMap;

import java.util.HashMap;
import java.util.Map;


public class HashMapFactory {


    private Mode mode = Mode.INT_HASH_MAP_MODE;

    public HashMapFactory(Mode mode) {
        this.mode = mode;
    }

    public Map<Integer, Integer> generateMap(int size) {
        if (mode == Mode.INT_HASH_MAP_MODE) {
            return generateIntHashMap(size);
        }
        if (mode == Mode.HASH_MAP_MODE) {
            return generateHashMap(size);
        }

        return null;
    }

    public IntHashMap generateIntHashMap(int size) {
        IntHashMap hashMap = new IntHashMap();
        for (int i = 0; i < size; ++i) {
            hashMap.put(i, i);
        }

        return hashMap;
    }

    public HashMap<Integer, Integer> generateHashMap(int size) {
        HashMap<Integer, Integer> hashMap = new HashMap<Integer, Integer>();
        for (int i = 0; i < size; ++i) {
            hashMap.put(i, i);
        }

        return hashMap;
    }


    public static enum Mode {
        INT_HASH_MAP_MODE, HASH_MAP_MODE
    }
}
